<?php
    // config
    #define('PIXEL_MODE', 'cli');
    require dirname(dirname(__FILE__)).'/config/environment.php';

    // simpltest files
    require VENDOR.'/simpletest/unit_tester.php';
    require VENDOR.'/simpletest/reporter.php';
    
    
    // start tester
    $test =& new GroupTest('Pixel App Tests');
    
    // find all files in the unit folder
    $files = glob( TESTS.'/*_test.php');
    if ( is_array($files) && !empty($files) )
    {
        foreach( $files as $file )
        {
            $test->addTestFile($file);
        }
    } else {
        die('no test files found');
    }
    
    // figure out if its from cli or from browser
    if (TextReporter::inCli()) {
        exit ($test->run(new TextReporter()) ? 0 : 1);
    }
    $test->run(new HtmlReporter());
?>